package com.qidianit.mes.pro.controller;

import com.github.pagehelper.PageInfo;
import com.qidianit.mes.pojo.Result;
import com.qidianit.mes.pojo.pro.Process;
import com.qidianit.mes.pojo.pro.ProcessStep;
import com.qidianit.mes.pro.service.ProcessService;
import com.qidianit.mes.pro.service.ProcessStepService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description:
 * @Author: wang fei long
 * @Date: 2025/9/17 0017 - 16:16
 */
@RestController
@RequestMapping("/processStep")
@CrossOrigin
public class ProcessStepController {
    @Autowired
    private ProcessStepService processStepService;
    @GetMapping("/page")
    public Result<PageInfo<ProcessStep>> selectAll(Long processId, @RequestParam(defaultValue = "1") int pageNum , @RequestParam(defaultValue = "10") int size){
        return processStepService.selectAll(processId,pageNum,size);
    }
    @GetMapping("/get/{id}")
    public Result<ProcessStep> selectById(@PathVariable Long id){
        return processStepService.selectById(id);
    }
    @PostMapping("/add")
    public Result insertProcessStep(@RequestBody ProcessStep processStep){
        return processStepService.insertProcessStep(processStep);
    }
    @PutMapping("/update")
    public Result updateById(@RequestBody ProcessStep processStep){
        return processStepService.updateById(processStep);
    }
    @DeleteMapping("/delete/{id}")
    public Result deleteById(@PathVariable Long id){
        return processStepService.deleteById(id);
    }

}
